package cn.wbnyua.resume.mvc.mapper;

import cn.wbnyua.resume.mvc.domain.Education;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * 作者：wbnyua.
 * 创建时间: 2023/2/6 21:59.
 */

@Mapper
public interface EducationMapper {

    @Select("select * from education")
    List<Education> findAll();

    @Select("select * from education where id = #{id}")
    Education findById(Long id);



    @Insert("insert into education(school,level,major) values(#{school},#{level},#{major})")
    @Options(useGeneratedKeys = true,keyProperty = "id")
    int add(Education education);





//UPDATE `myself`.`education` SET `school` = '广州理工学院', `level` = '本科', `major` = '软件工程' WHERE `id` = 1;
    @Update("update education set school = #{school},level = #{level},major = #{major} where id = #{id}")
    int update(Education education);

    @Delete("delete from education where id = #{id}")
    int remove(Long id);

}
